/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2024.
 * Description: RTOS Process Context asm header
 * Create: 2023-08-15
 */
#ifndef __ASM_RTOS_RTPC_H_
#define __ASM_RTOS_RTPC_H_

#define rtpc_set_current(task) \
	write_sysreg(task, sp_el0)

void rtpc_set_current_prepare(struct task_struct *task, void *sp);
void rtpc_context_switch_user(struct task_struct *prev, struct task_struct *next);
void rtpc_context_switch_kernel(struct task_struct *prev, struct task_struct *next);
void rtpc_context_switch(struct task_struct *prev, struct task_struct *next);
void rtpc_show_exception_info(unsigned long is_el0_sync, struct task_struct *tsk);
void *rtpc_alloc_cpu_context(void);
void rtpc_save_cpu_context(struct task_struct *tsk, void *save_context);
void rtpc_recover_cpu_context(struct task_struct *tsk, const void *save_context);

/* define in arch/arm64/kernel/process.c */
void rtpc_tls_thread_switch(struct task_struct *next);
void rtpc_entry_task_switch(struct task_struct *next);

/* define in arch/arm64/kernel/fpsimd.c */
void rtpc_fpsimd_thread_switch(struct task_struct *next);

DECLARE_PER_CPU(bool, rtpc_mm_fast_switch);
#endif
